package com.mxpio.erp.common.sales.entity;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.mxpio.erp.common.jpa.model.OrderLine;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_SALES_INVOICE_LINE")
@Schema(description="发票明细行")
public class InvoiceLine extends OrderLine {

	private static final long serialVersionUID = 1L;

	@Column(name = "INVOICE_QUANTITY_")
	@Schema(description = "已生成发票数量")
	private BigDecimal invoiceQuantity;

	@Column(name = "GENERATE_QUANTITY_")
	@Schema(description = "生成数量")
	private BigDecimal generateQuantity;

	@Column(name = "UNTAX_PRICE_")
	@Schema(description = "无税单价")
	private BigDecimal untaxPrice;

	@Column(name = "TAX_RATE_")
	@Schema(description = "税率")
	private BigDecimal taxRate ;

	@Column(name = "TAX_PRICE_")
	@Schema(description = "含税单价")
	private BigDecimal taxPrice;

	@Column(name = "TAX_")
	@Schema(description = "税额")
	private BigDecimal tax;

	@Column(name = "TOTAL_AMOUNT")
	@Schema(description = "价税合计")
	private BigDecimal totalAmount;

	@Column(name = "ORDER_BIZ_NO_")
	@Schema(description = "业务单号")
	private String orderBizNo;

	@Column(name = "MEMO_")
	@Schema(description = "备注")
	private String memo;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name="BIZ_NO_",insertable = false, updatable = false)
	@Schema(description = "发票")
	private Invoice invoice;
}
